public class ScratchList {
	private int[] data = new int[100];
	private int num = 0;
	
	public void pushBack(int x) {
		data[num] = x;
		num++;
		if (num == data.length) {
			int[] xin = new int[data.length * 2];
			for (int i = 0; i < data.length; i++) {
				xin[i] = data[i];
			}
			data = xin;
		}
	}
	
	public void remove(int n) {
		if (num >= n && n >= 1) {
			for (int i = n; i < num; i++) {
				data[i - 1] = data[i];
			}
			num--;
		}
	}
	
	public int get(int n) {
		if (1 <= n && n <= num) {
			return data[n - 1];
		} else {
			return 0;
		}
	}
	
	public void set(int n, int x) {
		if (1 <= n && n <= num) {
			data[n - 1] = x;
		}
	}
}
